import Vue from 'vue';
const loadingModal = Vue.extend(require('./spinLoading.vue').default);
let modalInstance;
let modal = {
  show(options) {
    /**options
     * 提示文字
     * **/
    if (modalInstance || typeof options != "string") return;
    modalInstance = new loadingModal({ propsData:{"loadText": options} });
    modalInstance.vm = modalInstance.$mount()
    document.getElementById("app").appendChild(modalInstance.vm.$el);

    modalInstance.modalVisible = true;
  },
  close() {
    if (!modalInstance||!modalInstance.modalVisible) return;
    modalInstance.modalVisible =false;
    setTimeout(() => {
      document.getElementById("app").removeChild(modalInstance.vm.$el);
      modalInstance.$destroy();
      modalInstance = null;
    }, 300);
  },
}
export default modal; 